__author__ = 'ezhenyz'
import os
from django.db import models

def getImagePath(path):
    def upload_callback(instance, filename):
        return os.path.join(path, filename)
    return upload_callback


class Picture(models.Model):
    pname = models.CharField(max_length = 256)
    pic = models.ImageField(upload_to="Cartoon/preview/")

    def __unicode__(self):
        return self.pic.url

    def getImgUrl(self):
        fp = self.pic
        return fp.url

